/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.oai.metadataRepository.metadata;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Martin Rehanek, Martin.Rehanek@gmail.com
 */
public enum MetadataFormat {

    marc21, ese, oai_dc;
    private static final String MARC21_SCHEMA_URL = "http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd";
    private static final String ESE_SCHEMA_URL = "http://www.europeana.eu/schemas/ese/ESE-V3.2.xsd";
    private static final String OAI_DC_SCHEMA_URL = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd";
    private static final String MARC21_NAMESPACE = "http://www.loc.gov/MARC21/slim";
    private static final String ESE_NAMESPACE = "http://www.openarchives.org/OAI/2.0/oai_dc/";
    private static final String OAI_DC_NAMESPACE = "http://www.openarchives.org/OAI/2.0/oai_dc/";
    private static final String MARC21_DIR = "marc21";
    private static final String ESE_DIR = "ese";
    private static final String OAI_DC_DIR = "oai_dc";
    private static final String TEI_DIR = "teip5";

    public URL getSchemaUrl() {
        try {
            switch (this) {
                case marc21:
                    return new URL(MARC21_SCHEMA_URL);
                case ese:
                    return new URL(ESE_SCHEMA_URL);
                case oai_dc:
                    return new URL(OAI_DC_SCHEMA_URL);
            }
        } catch (MalformedURLException ex) {
            Logger.getLogger(MetadataFormat.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    public String getNamespace() {
        switch (this) {
            case marc21:
                return MARC21_NAMESPACE;
            case ese:
                return ESE_NAMESPACE;
            case oai_dc:
                return OAI_DC_NAMESPACE;
            default:
                return null;
        }
    }

    public String getDirName() {
        switch (this) {
            case marc21:
                return MARC21_DIR;
            case ese:
                return ESE_DIR;
            case oai_dc:
                return OAI_DC_DIR;
            default:
                return null;
        }
    }
}
